package com.example.designer.iter.impl;

import com.example.designer.iter.pojo.Foot;

import java.util.Iterator;

public class ArrayIterator implements Iterator {

    Foot[] footArray;
    int pos = 0;

    public ArrayIterator(Foot[] footArray) {
        this.footArray = footArray;
    }

    @Override
    public boolean hasNext() {
        if (pos >= footArray.length || footArray[pos] == null){
            return false;
        }else {
            return true;
        }
    }

    @Override
    public Object next() {
        Foot foot = footArray[pos];
        pos++;
        return foot;
    }
}
